package com.tmc.service.inthotel.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tmc.service.inthotel.ComparePriceService;
import com.tourico.schemas.webservices.hotelv3.SearchHotelsByIdRequest;

@Service
@Transactional
public class ComparePriceServiceImpl implements ComparePriceService {

	private static final int thread_size = 2;
	private static final String THREAD_TORICO = "THREAD_TOURICO";
	private static final String THREAD_DIDA = "THREAD_DIDA";
	
	@Override
	public Double compareEachVendorPrice(SearchHotelsByIdRequest request) {
		
		/*if(!checkParam(request)){
			return null;
		}
		ExecutorService threadPool = Executors.newFixedThreadPool(thread_size);
		CompletionService<Entry<String, Object>> completion = new ExecutorCompletionService<Entry<String, Object>>(
				threadPool);
		completion.submit(new Callable<Entry<String, Object>>() {
			@Override
			public Entry<String, Object> call() throws Exception {
				SearchHotelsByIdResponse resp = hotelServiceImpl.searchHotelsById(touricoResq,null);
				return new AbstractMap.SimpleEntry<String, Object>(THREAD_DIDA, resp);
			}
		});*/
		
		return null;
	}
	
	public Boolean checkParam(SearchHotelsByIdRequest request){
		if(new Integer(request.getHotelIdsInfo().getHotelIdInfo().get(0).getId())==null){
			return false;
		}
		else if(request.getCheckIn()==null){
			return false;
		}
		else if(request.getCheckOut()==null){
			return false;
		}else if(request.getRoomsInformation().getRoomInfo().get(0).getAdultNum()==null){
			return false;
		}
		return true;
	}

}
